#include "Shm.hpp"
#include "Fifo.hpp"

int main()
{
    FileOper writefile(".", FIFO_FILE);
    writefile.OpenForWrite(); //打开管道文件

    Shm shm(PATHNAME, PROJ_ID, USER); //打开共享内存并挂载
    char* mem = (char*)shm.VirtualAdd();

    int i = 0;
    for(char c = 'A'; c <= 'G'; c++, i += 2)
    {
        sleep(1);
        mem[i] = c; //先向管道里写成对的字母
        mem[i+1] = c;
        sleep(1);
        
        writefile.Write(); //往管道里写（唤醒server进程）
    }

    writefile.Close(); //关闭文件
    return 0;
}
